<?php
namespace app\api\model\wanlshop;

use think\Model;
use think\Request;

class Category extends Model
{

    // 表名
    protected $name = 'wanlshop_category';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';

    // getImagesAttr
    public function getImageAttr($value, $data){
        $request = Request::instance();
        if (substr($request->url(), 0, 4) == '/api' && strpos($request->url(),'addOrder') == false) {
            return cdnurl($value, true);
        }
        return $value;
    }
}
